<template>
  <div style=" padding: 20px;">
    <basic-table
      :table-title="tableTitle"
      :data-source="dataSource"
      :data-params="dataParams"
      :multiple-table="false"
      class="mt-4"
    >
      <template v-slot:check="scope">
        <span style="color: #0087FE; cursor: pointer;" @click="changeStatus(scope.row)">
          查看
        </span>
      </template>
    </basic-table>

    <Modal
      :show="dialogVisible"
      :descriptions-info="descInfo"
      :descriptions-list="descriptionsList"
      @close="close"
    />
  </div>
</template>
<script>
import BasicTable from '@/components/BasicTable/index.vue'
import Modal from '@/components/Modal/Index'

import { getBiddings, getBiddingDetail } from '@/api/project'

export default {
  name: 'BasicInfos',
  components: { BasicTable, Modal },
  props: {
    projectId: { type: String, default: '' }
  },
  data() {
    return {
      dialogVisible: false,
      dataSource: () => getBiddings,
      dataParams: {},
      tableTitle: [
        {
          label: '数据等级',
          value: 'DataLevel',
          show: true,
          type: 'text'
        },
        {
          label: '中标单位',
          value: 'TenderComName',
          show: true,
          type: 'text'
        },
        {
          label: '招标类型',
          value: 'TenderType',
          show: true,
          type: 'text'
        },
        {
          label: '招标方式',
          value: 'TenderWay',
          show: true,
          type: 'text'
        },
        {
          label: '中标日期',
          value: 'TenderDate',
          show: true,
          type: 'text'
        },
        {
          label: '中标金额（万元）',
          value: 'TenderMoney',
          show: true,
          type: 'text'
        },
        {
          label: '中标通知书编号',
          value: 'TenderNumber',
          show: true,
          type: 'text'
        },
        {
          label: '省级中标通知书编号',
          value: 'ProvinceTenderNumber',
          show: true,
          type: 'text'
        },
        {
          label: '详情',
          show: true,
          type: 'slot',
          slot: 'check'
        }
      ],
      descriptionsList: {
        'ProjectName': '项目名称',
        'TenderPrjName': '工程名称',
        'TenderNum': '中标通知书编号',
        'ProvinceTenderNum': '省级中标通知书编号',
        'TenderType': '招标类型',
        'TenderWay': '招标方式',
        'TenderResultDate': '中标日期',
        'TenderMoney': '中标金额(万元)',
        'Area': '面积(平米)',
        'PrjSize': '建设规模',
        'TenderComName': '招标代理单位名称',
        'TenderComNum': '招标代理单位统一社会信用代码',
        'AgencyComName': '中标单位名称',
        'AgencyComNum': '中标单位统一社会信用代码',
        'DutyPerName': '项目负责人',
        'IdCardType': '证件类型',
        'IdCard': '身份证号码',
        'RegistrationDate': '记录登记时间',
        'DataSource': '数据来源',
        'DataLevel': '数据等级'
      },
      descInfo: null
    }
  },
  created() {
    this.dataParams.projectId = this.projectId
  },
  methods: {
    close(v) {
      this.dialogVisible = v
    },
    //  查看
    changeStatus(v) {
      getBiddingDetail({
        id: v.Id,
        projectId: this.projectId
      }).then(res => {
        if (res.code === 200) {
          this.dialogVisible = true
          this.descInfo = res.data.detail
        }
      })
    }
  }
}
</script>

<style scoped>

</style>
